package com.example.servicedemo;

public enum BtleDeviceError {
	/**********************************************************************
	 * Unable to access Android Bluetooth Service.
	 **********************************************************************/
	ANDROID_BLUETOOTH_SERVICE_UNAVAILABLE(1),
	/**********************************************************************
	 * Bluetooth LE is not available on this device.
	 **********************************************************************/
	BLUETOOTH_LE_NOT_AVAILABLE(2),
	/**********************************************************************
	 * Bluetooth radio is disabled on device.
	 **********************************************************************/
	BLUETOOTH_RADIO_DISABLED(3),
	/**********************************************************************
	 * Bluetooth address is invalid.
	 **********************************************************************/
	BTLE_ADDRESS_INVALID(4),
	/**********************************************************************
	 * Unable to contact device, likely powered off or out of range.
	 **********************************************************************/
	BTLE_DEVICE_CONNECTION_FAILED(5),
	/**********************************************************************
	 * Unable to find any valid services advertised on device.
	 **********************************************************************/
	BTLE_SERVICE_DISCOVERY_FAILED(6),
	/**********************************************************************
	 * Device does not have a valid service that we support.
	 **********************************************************************/
	BTLE_SERVICE_NOT_FOUND(7),
	/**********************************************************************
	 * Could not connect to target service.
	 **********************************************************************/
	BTLE_SERVICE_CONNECTION_FAILED(8),
	/**********************************************************************
	 * Unable to find requested measurement characteristic.
	 **********************************************************************/
	BTLE_CHARACTERISTIC_NOT_FOUND(9),
	/**********************************************************************
	 * Failed to set characteristic notification for target characteristic.
	 **********************************************************************/
	BTLE_CHARACTERISTIC_SET_FAILED(10),
	/**********************************************************************
	 * Failed to acquire requested characteristic descriptor, notifications
	 * are not enabled.
	 **********************************************************************/
	BTLE_CHARACTERISTIC_NOTIFY_START_FAILED(11);
	
	@SuppressWarnings("unused")
	private int value;
	
	private BtleDeviceError(int v) {
		value = v;
	}
	
	/**************************************************************
	 * Returns a string that explains the error.
	 **************************************************************/
	@Override
	public String toString() {
		switch(this) {
		case ANDROID_BLUETOOTH_SERVICE_UNAVAILABLE:
			return new String("Unable to access Android Bluetooth Service.");
		case BLUETOOTH_LE_NOT_AVAILABLE:
			return new String("Bluetooth LE is not available on this device.");
		case BLUETOOTH_RADIO_DISABLED:
			return new String("Bluetooth radio is disabled on device.");
		case BTLE_ADDRESS_INVALID:
			return new String("Bluetooth address is invalid.");
		case BTLE_DEVICE_CONNECTION_FAILED:
			return new String("Unable to contact device, likely powered off or out of range.");
		case BTLE_SERVICE_DISCOVERY_FAILED:
			return new String("Unable to find any valid services advertised on device.");
		case BTLE_SERVICE_NOT_FOUND:
			return new String("Device does not have a valid service that we support.");
		case BTLE_SERVICE_CONNECTION_FAILED:
			return new String("Could not connect to target service.");
		case BTLE_CHARACTERISTIC_NOT_FOUND:
			return new String("Unable to find requested measurement characteristic.");
		case BTLE_CHARACTERISTIC_SET_FAILED:
			return new String("Failed to set characteristic notification for target characteristic.");
		case BTLE_CHARACTERISTIC_NOTIFY_START_FAILED:
			return new String("Failed to acquire requested characteristic descriptor, notifications are not enabled.");
			
		}
		
		return null;
		
	}
	
}
